Classname StatisticFunctions
Provides public static functions for the website statistics.
Note: this class will be used by the implementation classes AND the backend of the feindura-CMS.
static array | $adminConfig | Contains the administrator-settings config array |
static array | $categoryConfig | Contains the category-settings config array |
static array | $websiteConfig | Contains the website-config array |
static array | $websiteStatistic | Contains the website-statistic array |
static array | $statisticConfig | Contains the backend-statistic config array |
static array | $pagesMetaData | Contains the pagesMetaData array |
static string|false | $browser | The current Browser name |
static void | init() | The real constructor of the static class, gets the settings. Used Global Variables |
static string | urlEncode() | Encodes a string to url, but before it removes all tags and htmlentitites. |
static int|false | getCurrentPageId() | Returns the current page ID from the $_GET variable. Gets the current page ID from the |
static bool | isPageStatisticsArray() | Checks the given $page parameter is a valid $pageStatistics array. |
static array|FALSE|NULL | readPageStatistics() | Loads the $pageStatistics array of a page. Includes the page statistics. Example of the returned |
static bool | savePageStatistics() | Save a page statistics to it's flatfile. |
static bool | saveRefererLog() | Adds a entry to the referer log-file. This log file saves the referer URLS of the users visiting the website. |
static string|false | getBrowser() | Returns the right browser name. |
static string | addDataToDataString() | Adds a new string to a data-string and counts the string up if its already existing. Example dataString: |
static bool | isRobot() | Check if the user-agent is a spider/bot/webcrawler. This method uses the |
static bool | visitorCache() | Creates a visitor.statistic.cache file and store the md5 sum of the user agent + ip with a timestamp. If |
static array | getCurrentVisitor() | Gets the current visitor (only the CURRENT) from the visitCache file |
static array | getCurrentVisitors() | Gets the current visitors (ALL) from the visitCache file (statistic/visitor.statistic.cache) |
static bool | saveWebsiteStats() | Saves the following values of the website-statistic:
|
static bool | refreshPageStatistics() | Saves the following values of the page-statistic:
|
void | __construct() | Constructor is not callable, StatisticFunctions::init() is used instead. |
int|false | getCurrentCategoryId() | Returns the current category ID from the $_GET variable. Gets the current category ID from the $_GET variable.... |
Contains the administrator-settings config array
Contains the category-settings config array
Contains the backend-statistic config array
This array contains the number of task logs and referrer logs saved until the last line is droped.
Example array:
Show Example
Contains the pagesMetaData array
This array contains all pages IDs and their category ID, as well as the localized titles
Example array:
Show Example
Type init
The real constructor of the static class, gets the settings.
Used Global Variables
string|false | $string |
the string to urlencode |
Name urlEncode()
Encodes a string to url, but before it removes all tags and htmlentitites.
int | $startPage |
the startPage, given when it comes from the Feindura class Default null |
$category |
Default null |
Name getCurrentPageId()
Returns the current page ID from the $_GET variable.
Gets the current page ID from the $_GET variable. If $_GET is not a ID but a page name, it loads all pages in an array and look for the right page name and returns the ID. If no $_GET variable exists try to return the $startPage parameter.
Used Global Variables
int|array | $page |
the variable to check |
Name isPageStatisticsArray()
Checks the given $page parameter is a valid $pageStatistics array.
int | $pageId |
a page ID or a $pageStatistics array (will then returned immediately) |
Name readPageStatistics()
Loads the $pageStatistics array of a page.
Includes the page statistics.
Example of the returned $pageStatistics array:
Show Example
array | $pageStatistics |
the $pageStatistics array of the page to save |
Name savePageStatistics()
Save a page statistics to it's flatfile.
Example of the saved $pageStatistics array:
Show Example
Name saveRefererLog()
Adds a entry to the referer log-file. This log file saves the referer URLS of the users visiting the website.
Name getBrowser()
Returns the right browser name.
string | $dataString |
the data-string which the $dataToAdd parameter will be add to |
string|array | $dataToAdd |
a string or an array with data to add, OR a unserialized data-string |
Name addDataToDataString()
Adds a new string to a data-string and counts the string up if its already existing.
Example dataString:
Show Example
Name isRobot()
Check if the user-agent is a spider/bot/webcrawler. This method uses the "library/thirdparty/spider.xml".
The list of spiders it uses is from: http://www.wolfshead-solutions.com/spiders-list
bool | $add |
if this is FALSE, it only check if the agents in the cache are still up to date, without adding a user agent Default true |
Name visitorCache()
Creates a visitor.statistic.cache file and store the md5 sum of the user agent + ip with a timestamp. If the agent load again the website, it check if the agent is already in the cache and the timelimit of 10 min is not passed.
This public static function is used when the session ID cannot be transfered, because of deactivated cookies or no session ID in the link was transfered.
An example of the saved cache lines 1306733465|#|visitor|#|c5b5533c8475801044fb7680059d5846|#|192.168.0.1
Name getCurrentVisitor()
Gets the current visitor (only the CURRENT) from the visitCache file (statistic/visitor.statistic.cache)
Name getCurrentVisitors()
Gets the current visitors (ALL) from the visitCache file (statistic/visitor.statistic.cache)
false|int | $page |
a page ID, of the current page, where the page statistic should be saved Default false |
Name saveWebsiteStats()
Saves the following values of the website-statistic:
$pageContent | $pageId |
the $pageContent array of the page |
Name refreshPageStatistics()
Saves the following values of the page-statistic:
Type constructor
Constructor is not callable, StatisticFunctions::init() is used instead.
$startCategory |
Default null |
Name getCurrentCategoryId()
Returns the current category ID from the $_GET variable.
Gets the current category ID from the $_GET variable. If $_GET is not a ID but a category name, it look in the FeinduraBase::$categoryConfig for the right category ID. If no $_GET variable exists it try to return the Feindura::$startPage property.
Used Global Variables